<%@page import="cn.edu.pku.wxlib.category.model.*"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags/simpletable" prefix="simpletable"%>
<%@ include file="/commons/taglibs.jsp"%>

<rapid:override name="head">
	<title>Category维护</title>

	<script src="${ctx}/scripts/rest.js"></script>
	<link href="<c:url value="/widgets/simpletable/simpletable.css"/>"
		type="text/css" rel="stylesheet">
	<script type="text/javascript"
		src="<c:url value="/widgets/simpletable/simpletable.js"/>"></script>

	<script type="text/javascript">
		$(document).ready(function() {
			window.simpleTable = new SimpleTable('queryForm',${page.thisPageNumber},${page.pageSize},'${pageRequest.sortColumns}');
		});
	</script>
</rapid:override>

<rapid:override name="content">
	<form id="queryForm" name="queryForm" method="get"
		style="display: inline;">
		<div class="search">
			<div class="form-group inline icon">
				<i class="icon-list"></i><input placeholder="请输入父类型"
					value="${query.parentCategoryId}" id="parentCategoryId"
					name="parentCategoryId" maxlength="10" class="form-field col-3" />
			</div>
			<div class="form-group inline icon">
				<i class="icon-list"></i><input placeholder="请输入类型名"
					value="${query.categoryName}" id="categoryName" name="categoryName"
					maxlength="32" class="form-field col-3" /> <br />
			</div>
			<%-- <div class="form-group inline icon">
				<label>备注</label> <input placeholder="请输入备注" value="${query.remark}"
					id="remark" name="remark" maxlength="128" class="form-field" /> <br />
			</div> --%>
			<div class="form-group inline">
				<select id="state" class="form-field col-1">
					<option value="">选择状态</option>
					<option value="1">启用</option>
					<option value="0">禁用</option>
				</select>
			</div>

			<div class="form-group inline icon search-btn"
				onclick="$('#queryForm').submit();" title="查询">
				<i class="icon-search"></i>
			</div>

			<%-- <button type="button" class="btn btn-default"
				onclick="getReferenceForm(this).action='${ctx}/category'">查询</button> --%>
		</div>
	</form>
	<div class="handleControl">
		<button type="button" class="btn btn-primary"
			onclick="window.location = '${ctx}/category/new'">新增分类</button>
		<button type="button" class="btn btn-default"
			onclick="doRestBatchDelete('${ctx}/category','items',document.forms.queryForm)">删除</button>
	</div>

	<div class="gridTable">
		<table width="100%" border="0" cellspacing="0"
			class="table text-center">
			<thead>
				<tr>
					<th style="width: 1px;"><input type="checkbox"
						onclick="setAllCheckboxState('items',this.checked)"></th>
					<th sortColumn="parentCategoryId">父类型</th>
					<th sortColumn="categoryName">类型名称</th>
					<th sortColumn="remark">备注</th>
					<th sortColumn="state">状态</th>
					<th style="white-space: nowrap;">操作</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${page.result}" var="item" varStatus="status">
					<tr>
						<td><input type="checkbox" name="items"
							value="${item.categoryId}"></td>
						<td><c:out value='${item.parentCategoryId}' />&nbsp;</td>
						<td><c:out value='${item.categoryName}' />&nbsp;</td>
						<td><c:out value='${item.remark}' />&nbsp;</td>
						<td><c:out value='${item.state}' />&nbsp;</td>
						<td><a href="${ctx}/category/${item.categoryId}" class="operation">查看</a>&nbsp;&nbsp;
							<a href="${ctx}/category/${item.categoryId}/edit" class="operation">修改</a>&nbsp;&nbsp;
							<a href="${ctx}/category/${item.categoryId}"
							onclick="doRestDelete(this,'你确认删除?');return false;" class="operation">删除</a></td>
					</tr>

				</c:forEach>
			</tbody>
		</table>

		<simpletable:pageToolbar page="${page}">
		</simpletable:pageToolbar>

	</div>
</rapid:override>
<rapid:override name="script">
	<script></script>
</rapid:override>
<%@ include file="base.jsp"%>
